#
#	Makefile for dcmpstat/jni
#
# This makefile requires changes specific for the operating system
# and compiler that are not automatically adjusted by "configure".
#
# In addition, the CXXFLAGS in config/Makefile.def must be adjusted
# _before_ compiling dcmtk to create position independent code
# (e.g. -fPIC for gcc, -PIC for Sun CC)
#

@SET_MAKE@

SHELL = /bin/sh
VPATH = @srcdir@:@top_srcdir@/include:@top_srcdir@/@configdir@/include
srcdir = @srcdir@
top_srcdir = @top_srcdir@
configdir = @top_srcdir@/@configdir@

include $(configdir)/@common_makefile@

#
# Settings for Solaris 2.x with Sun CC 4.2 compiler
#
javainc = -I/usr/java1.3/include -I/usr/java1.3/include/solaris
soflags = -G
solibs = -lC

#
# Settings for Linux (glibc) with gcc 2.95 (and above) compiler
#
# Include files for Sun J2SE 1.3, Blackdown JDK 1.2 or IBM JDK 1.3
# javainc = -I/usr/lib/SunJava2/include -I/usr/lib/SunJava2/include/linux
# javainc = -I/usr/jdk1.2/include -I/usr/jdk1.2/include/linux
# javainc = -I/opt/IBMJava2-13/include
# soflags = -shared

ofstddir = $(top_srcdir)/../ofstd
ofstdinc = -I$(ofstddir)/include
ofstdlibdir = -L$(ofstddir)/libsrc
ofstdlib = -lofstd

dcmdatadir = $(top_srcdir)/../dcmdata
dcmdatainc = -I$(dcmdatadir)/include
dcmdatalibdir = -L$(dcmdatadir)/libsrc
dcmdatalib = -ldcmdata

dcmnetdir = $(top_srcdir)/../dcmnet
dcmnetinc = -I$(dcmnetdir)/include
dcmnetlibdir = -L$(dcmnetdir)/libsrc
dcmnetlib = -ldcmnet

dcmimgledir = $(top_srcdir)/../dcmimgle
dcmimgleinc = -I$(dcmimgledir)/include
dcmimglelibdir = -L$(dcmimgledir)/libsrc
dcmimglelib = -ldcmimgle

dcmpstatdir = $(top_srcdir)/../dcmpstat
dcmpstatinc = -I$(dcmpstatdir)/include
dcmpstatlibdir = -L$(dcmpstatdir)/libsrc
dcmpstatlib = -ldcmpstat

dcmqrdbdir = $(top_srcdir)/../dcmqrdb
dcmqrdbinc = -I$(dcmqrdbdir)/include
dcmqrdblibdir = -L$(dcmqrdbdir)/libsrc
dcmqrdblib = -ldcmqrdb

dcmsigndir = $(top_srcdir)/../dcmsign
dcmsigninc = -I$(dcmsigndir)/include
dcmsignlibdir = -L$(dcmsigndir)/libsrc
dcmsignlib = -ldcmdsig

dcmsrdir = $(top_srcdir)/../dcmsr
dcmsrinc = -I$(dcmsrdir)/include
dcmsrlibdir = -L$(dcmsrdir)/libsrc
dcmsrlib = -ldcmsr

dcmjpegdir = $(top_srcdir)/../dcmjpeg
dcmjpeginc = -I$(dcmjpegdir)/include
dcmjpeglibdir = -L$(dcmjpegdir)/libsrc -L$(dcmjpegdir)/libijg8 -L$(dcmjpegdir)/libijg12 \
	-L$(dcmjpegdir)/libijg16
dcmjpeglib = -ldcmjpeg -lijg8 -lijg12 -lijg16

LOCALINCLUDES = $(dcmpstatinc) $(ofstdinc) $(dcmnetinc) $(dcmdatainc) $(dcmimgleinc) \
	$(dcmqrdbinc) $(dcmsigninc) $(dcmsrinc) $(dcmjpeginc) $(javainc)
LIBDIRS = -L$(top_srcdir)/libsrc $(dcmpstatlibdir) $(dcmqrdblibdir) $(dcmnetlibdir) \
	$(dcmdatalibdir) $(ofstdlibdir) $(dcmimglelibdir) $(dcmsignlibdir) $(dcmsrlibdir) \
	$(dcmjpeglibdir)
LOCALLIBS = $(dcmpstatlib) $(dcmsrlib) $(dcmsignlib) $(dcmjpeglib) $(dcmimglelib) \
	$(dcmqrdblib) $(dcmnetlib) $(dcmdatalib) $(ofstdlib) $(OPENSSLLIBS) $(solibs)

objs = DVInterface.o DVPSGraphicObject.o DVPresentationState.o DVPSCurve.o \
	DVPSTextObject.o DVPSStoredPrint.o DSRCodeValue.o DSRCompositeValue.o \
	DSRDocument.o DSRDocumentTree.o DSRImageValue.o DSRNumericValue.o \
	DSRSCoordValue.o DSRTCoordValue.o DSRWaveformValue.o
library = libjInterface.so


all: $(library)

$(library): $(objs)
	$(CXX) $(CXXFLAGS) $(LIBDIRS) $(LDFLAGS) $(soflags) -o $@ $(objs) $(LOCALLIBS) $(LIBS)


install: all
	$(configdir)/mkinstalldirs $(DESTDIR)$(libdir)
	$(INSTALL_DATA) $(library) $(DESTDIR)$(libdir)/$(library)

clean:
	rm -f $(objs) $(library) $(TRASH)

distclean:
	rm -f $(objs) $(library) $(DISTTRASH)


dependencies:
	$(CXX) -MM $(defines) $(includes) $(CPPFLAGS) $(CXXFLAGS) *.cc  > $(DEP)

include $(DEP)
